package cn.czg.cms.mapper;

import cn.czg.cms.entity.Post;
import cn.czg.cms.entity.dto.PostDTO;
import cn.czg.cms.entity.dto.PostWithUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

public interface PostMapper extends BaseMapper<Post> {


    IPage<PostDTO> selectPostsByLocation(Page<?> page,
                                         @Param("lng") Double lng,
                                         @Param("lat") Double lat,
                                         @Param("order") String order,
                                         @Param("type") String type,
                                         @Param("searchKey") String searchKey);

    void updateLikeCount(String postId, int like);

    IPage<PostWithUser> selectPageWithUser(Page<?> page, @Param("userId") Long userId);


    PostWithUser detail(String id);
}
